package itheima.com.zuoye.zy2;

public class Test {
//    定义一个方法,可以求出任意个整数的和.然后在主方法中调用.
    public static int getSum(int... args){
        int sum = 0;
        for (int i = 0; i < args.length; i++) {
            sum += args[i];
        }
        return sum;
    }

    public static void main(String[] args) {
        int []sum  = {1,2,3,4,5,6,7,8,9,10};
        System.out.println(sum.length+"个数的和为:"+getSum( sum));

    }
}
